import React, {useMemo} from 'react';
import {View, Text, StyleSheet, ViewStyle} from 'react-native';
import {sin} from 'react-native-reanimated';

interface PropsType {
  size?: number;
  color?: string;
  style?: ViewStyle;
}
/**
 * 线条组件
 * @param props PropsType
 * @returns JSX.Element
 */
export default function Line(props: PropsType) {
  const {color, size, style} = props;
  const lineStyle = useMemo(() => {
    let computed = {...styles.line};
    if (style) {
      Object.assign(computed, style);
    }
    if (color) {
      computed.backgroundColor = color;
    }
    if (size) {
      computed.height = size;
    }
    return computed;
  }, [color]);
  return <View style={lineStyle} />;
}

const styles = StyleSheet.create({
  line: {
    flex: 1,
    height: 0.5,
    backgroundColor: '#E8E8E8',
  },
});
